package cn.kgc.util;

import cn.kgc.entity.SmbmsRole;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * @author wangyue
 * @version 1.0
 */
public class SmbmsRoleSerialize extends JsonSerializer<SmbmsRole> {

    @Override
    public void serialize(SmbmsRole smbmsRole, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeStartObject();
        jsonGenerator.writeStringField("id",smbmsRole.getId()+"");
        jsonGenerator.writeStringField("roleName",smbmsRole.getRolename());
        jsonGenerator.writeStringField("roleCode",smbmsRole.getRolecode());
        jsonGenerator.writeStringField("version",smbmsRole.getVersion()+"");
        jsonGenerator.writeEndObject();
    }
}
